/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

package com.facebook.common.abilitylistener;

import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;

/**
 * Listener interface for ability lifecycle events.
 *
 * <p>All methods take the Ability so it's possible to implement a singleton version of this
 * interface that has no-state.
 */
public interface AbilityListener {
    static final int MIN_PRIORITY = 1;
    static final int MAX_PRIORITY = 10;

    /**
     * Called by the Ability base class after the Ability's <code>onAbilityCreate</code> method has
     * run.
     *
     * @param ability the ability
     */
    void onAbilityCreate(Ability ability);

    /**
     * Called by the Ability base class from the {@link Ability#onStart} method.
     *
     * @param ability the ability
     */
    void onStart(Ability ability);

    /**
     * Called by the Ability base class from the {@link Ability#onResume} method.
     *
     * @param ability the ability
     */
    void onResume(Ability ability);

    /**
     * Called by the Ability base class from the {@link Ability#onPause} method.
     *
     * @param ability the ability
     */
    void onPause(Ability ability);

    /**
     * Called by the Ability base class from the {@link Ability#onStop} method.
     *
     * @param ability the ability
     */
    void onStop(Ability ability);

    /**
     * Called by the Ability base class from the {@link Ability#onDestroy} method.
     *
     * @param ability the ability
     */
    void onDestroy(Ability ability);

    /**
     * Listeners are fired in order of priority. Listeners with higher priority are fired first.
     *
     * @return priority level
     */
    int getPriority();
}
